import { defineConfig } from 'tsup'
import { resolve } from 'path'

export default defineConfig({
  entry: {
    main: 'src/main/index.ts',
    preload: 'src/preload/index.ts'
  },
  format: ['cjs'],
  target: 'node18',
  platform: 'node',
  external: ['electron'],
  noExternal: ['@roasmax/weibo-scraper', '@roasmax/browser', '@roasmax/logger'],
  sourcemap: true,
  clean: true,
  minify: false,
  splitting: false,
  esbuildOptions(options) {
    options.alias = {
      '@': resolve(__dirname, 'src'),
      '@main': resolve(__dirname, 'src/main'),
      '@renderer': resolve(__dirname, 'src/renderer'),
      '@shared': resolve(__dirname, 'src/shared'),
      '@preload': resolve(__dirname, 'src/preload')
    }
  }
})
